<template>
    <div>
        <el-card class="box-card">
            <div slot="header" class="clearfix" style="text-align: center;line-height: 30px">
                <h3>添加客户信息</h3>
            </div>

            <div class="text item">
                <el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm">

                    <el-row>
                        <el-col :span="12">
                            <div class="grid-content bg-purple">
                                <el-form-item label="客户名称" prop="name">
                                    <el-input v-model="ruleForm.name"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="grid-content bg-purple-light">
                                <el-form-item label="负责人" prop="name">
                                    <el-input v-model="ruleForm.mainperson"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                    <br>

                    <el-row>
                        <el-col :span="12">
                            <div class="grid-content bg-purple">
                                <el-form-item label="负责人电话" prop="name">
                                    <el-input v-model="ruleForm.tel"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="grid-content bg-purple-light">
                                <el-form-item label="办公地址" prop="name">
                                    <el-input v-model="ruleForm.address"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                    <br>

                    <el-row>
                        <el-col :span="12">
                            <div class="grid-content bg-purple">
                                <el-form-item label="邮箱" prop="name">
                                    <el-input v-model="ruleForm.email"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :span="12">
                            <div class="grid-content bg-purple-light">
                                <el-form-item label="经营范围">
                                    <el-input type="textarea" v-model="ruleForm.scope"></el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                    <br>

                    <el-row>
                        <div style="text-align: center">
                            <el-form-item>
                                <el-button type="primary" @click="add">添加</el-button>
                            </el-form-item>
                        </div>
                    </el-row>
                </el-form>
            </div>
        </el-card>
    </div>
</template>

<script>
    export default {
        name: "AddClient",
        data() {
            return {
                ruleForm: {
                    name: '',
                    mainperson: '',
                    tel: '',
                    address: '',
                    email: '',
                    scope: ''
                }
            }
        },
        methods: {
            add() {
                let url = "api/custom/save?address="+this.ruleForm.address+
                    "&boss="+ this.ruleForm.mainperson+
                    "&customname="+this.ruleForm.name+"&email=%20" +
                    "&phone="+this.ruleForm.tel+"&scope="+this.ruleForm.scope
                this.$axios.get(url).then(r => {

                    if (r.data == true) {
                        this.$router.push("CustomerView")
                    }

                })
            }
        }
    }
</script>

<style scoped>

</style>